/*
 * @Author: liuYang codkly@gmail.com
 * @Date: 2022-12-08 11:12:55
 * @LastEditors: liuYang codkly@gmail.com
 * @LastEditTime: 2022-12-08 11:13:06
 * @FilePath: \coding\nest\blog_alpha\src\core\interceptor\transform\transform.interceptor.ts
 * @Description: 
 * 暂无备注
 */
import {CallHandler, ExecutionContext, Injectable,NestInterceptor,} from '@nestjs/common';
import { map, Observable } from 'rxjs';

@Injectable()
export class TransformInterceptor implements NestInterceptor {
  intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
    return next.handle().pipe(
      map((data) => {
        return {
          data,
          code: 0,
          msg: '请求成功',
        };
      }),
    );
  }
}